/* 
  搜索页面相关接口
*/

// 引入
import axios from 'axios';
import request from '@/utils/request_wwl';
import {
  Category2ListModel,
  CategoryListModel,
  realModel,
} from './model/searchModel';

// 使用枚举包含所有的path
enum Api {
  GetHotWordBillboardCategory = '/hotWordBillboardCategory',
  GetHotWordBillboardCategory2 = '/hotWordBillboard/list/2.0',
  GetRealSearch = '/revision/suggest',
}

// 发送搜索分类列表的请求
export const getHotCategoryApi = () => {
  return request.get<CategoryListModel>(Api.GetHotWordBillboardCategory);
};

// 发送二级分类的请求
export const getHotCategory2Api = (categoryId: number, size: number) => {
  return request.get<Category2ListModel>(
    Api.GetHotWordBillboardCategory2 + `?categoryId=${categoryId}&size=${size}`
  );
};

export const getRealSearchApi = (kw: string) => {
  return axios.get(
    '/app-dev/revision/suggest' + `?kw=${kw}&paidFilter=false&scope=all`
  );
};
